<template>
  <div class="video-view">
    <iframe
      width="100%"
      height="100%"
      :src="videoUrl"
      frameborder="0"
      allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
      allowfullscreen
    ></iframe>
  </div>
</template>

<script>
export default {
  name: "VideoView",
  props: {
    url: {
      type: String,
      default: "",
    },
  },
  data() {
    return {
      prefix: "https://jx.xmflv.cc/?url=",
    };
  },
  computed: {
    videoUrl() {
      if (this.url.startsWith("http") || this.url.startsWith("https")) {
        return this.prefix + this.url;
      } else {
        return this.prefix + "";
      }
    },
  },
};
</script>

<style lang="less" scoped>
.video-view {
  height: 60vh;
}
</style>